<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h2>解构赋值</h2>
</body>
<script>
    //1.数组解构
    const arr = ['vue.js', 'react.js', 'angular']

    let [s1, s2, s3] = arr


    //2.对象解构

    let obj1 = {
        name: '张三',
        age: 20,
        address: '北京'
    }

    const {
        name: username,
        age: nianling,
        address: dizhi
    } = obj1

    //3.字符串解构 类似于数组的解构
    let str = 'hello'
    let [a, b, c] = str;

    console.log(a)
    console.log(b)
    console.log(c)
</script>

</html>